import React,{ Component , PropTypes } from 'react';
import * as CounterActions from '../actions/user'
import { Link } from 'react-router';
import { bindActionCreators } from 'redux'
import { connect } from 'react-redux'

class User extends Component {
	render(){
		const {user,pushUser} = this.props;
		return(
			<div>
				<div>姓名：{user.name}</div>
				<div>年龄：{user.age}</div>
				<br />
				<div onClick={pushUser}>点击更新user</div>
				<br />
				<div>
					<div><Link to="/users">跳转到usersList</Link></div>
				</div>
			</div>
		);
	} 
}



function mapStateToProps(state) {
  return {
    user: state.user
  }
}

function mapDispatchToProps(dispatch) {
  return bindActionCreators(CounterActions, dispatch);
}

export default connect(mapStateToProps,mapDispatchToProps)(User)
